package tp.banco.servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tp.banco.acceso.cliente.Clientedao;
import tp.banco.tablas.Tcliente;

/**
 * Servlet implementation class Scliente
 */
public class Scliente extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Scliente() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Tcliente cliente = new Tcliente();
		
		cliente.setDNI(request.getParameter("dni"));
		cliente.setNombre(request.getParameter("nombre"));
		cliente.setApellido(request.getParameter("apellido"));
		cliente.setDireccion(request.getParameter("direccion"));
		cliente.setEmail(request.getParameter("email"));
		cliente.setCuentas(Integer.valueOf(request.getParameter("Cuentas")));
		
		Clientedao cliedao = new Clientedao();
		
		cliedao.altaCliente(cliente);
	}

}
